<template>
  <!-- 头部部分 -->
  <header class="header">
    <h1>todos</h1>
    <input
        v-model.trim="addEvent.name"
        class="new-todo"
        placeholder="请输入任务名称"
        @keyup.enter="addFn"
    />
  </header>
</template>
<script>
export default {
  data () {
    return {
      addEvent: { name: '', isDone: false, }
    }
  },
  methods: {
    async addFn () {
      if (this.addEvent.name) {
        await this.$store.dispatch('todo/addList', this.addEvent)
        this.addEvent.name = ''
      }
    }
  },
}
</script>
